package snafu;

import snafu.controller.WorldController;
import snafu.framework.agents.AgentItself;
import snafu.framework.worlds.Position;
import snafu.framework.worlds.WorldMap;
import snafu.gui.MainFrame;
import snafu.implementation.agents.BananaTree;
import snafu.implementation.agents.HungryApeAgent;
import snafu.implementation.objects.grass.GrassItself;
import snafu.implementation.worlds.SquareWorldMap;

public class Snafu {
	public static void main(String[] args) {
		// the map and controller
		WorldMap worldMap = new SquareWorldMap(10, 10);
		final WorldController controller = new WorldController(10, worldMap);

		// fill map with grass
		controller.fillMapWith(GrassItself.class);
		
		// add trees
		for (int i = 0; i < 6; i++) {
			int rX = (int) (Math.random() * worldMap.getWidth());
			int rY = (int) (Math.random() * worldMap.getHeight()); 
			controller.addObject(new Position(rX, rY), new AgentItself(new BananaTree()));
		}
		
		// add apes
		for (int i = 0; i < 2; i++) {
			int rX = (int) (Math.random() * worldMap.getWidth());
			int rY = (int) (Math.random() * worldMap.getHeight()); 
			controller.addObject(new Position(rX, rY), new AgentItself(new HungryApeAgent()));
		}
		
		// GUI
		new MainFrame(controller);
	}
}
